home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0136_New ANIVGA Fade - Vertical.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  3KB  |  88 lines

  1. {
  2.   Yes,  I  should have been able to imagine myself that there will be at
  3.   least  _one_ person out there who asks for the Fade_VerticalSplitClose
  4.   after  he  has  tried  the  Fade_HorizontalSplitClose for AniVGA V1.2,
  5.   couldn't I?... <sigh>
  6.   Well,  here  it  is;  for  the  bored  ones  amongst us, here's a more
  7.   challenging question:
  8.  
  9.   What  do you expect to see when you remove the comment brackets of the
  10.   line  in the main body part of the snippet below? --Try to answer that
  11.   question w/o further trying! :-)
  12.  
  13. kai.rohrbacher@logo.ka.sub.org
  14. }
  15.  
  16. {$A+,B-,D+,L+,N-,E-,O-,R-,S-,V-,G-,F-,I-,X+}
  17. {$M 32768,0,655360}
  18. PROGRAM Example8E;
  19. USES ANIVGA;
  20.  
  21. CONST pic='DOG1.PIC';      {or any other PIC}
  22.       picPal1='DOG1.PAL';
  23. {$IFDEF VER60}
  24.       Seg0040:WORD=$40;
  25. {$ENDIF}
  26.  
  27.   PROCEDURE VerticalSplitClose(pa,time:WORD);
  28.   { in: pa    = page, which contents will be made visible }
  29.   {     time  = time (in milliseconds) for this action (approx.) }
  30.   {out: - }
  31.   {rem: the contents of page "pa" has been copied to page 1-PAGE }
  32.   CONST n = (YMAX+1) DIV 2; {number of executions of the delay loop}
  33.   VAR counter:WORD;
  34.       ClockTicks:^LONGINT; {LONGINT ABSOLUTE $40:$6C geht nicht}
  35.       t: LONGINT;
  36.       temp:REAL;
  37.       mitte,lines:INTEGER;
  38.  
  39.       p:POINTER;
  40.  
  41.   BEGIN
  42.    ClockTicks:=Ptr(Seg0040,$6C);
  43.    t := ClockTicks^;
  44.    counter := 0;
  45.    temp := 0.0182*time/n;
  46.  
  47.    mitte:=YMAX SHR 1;
  48.    FOR lines:=0 TO mitte DO
  49.     BEGIN
  50.      p:= GetImage(StartVirtualX,StartVirtualY+mitte-lines,
  51.                   StartVirtualX+XMAX,StartVirtualY+mitte,pa);
  52.      PutImage(StartVirtualX,StartVirtualY,p,1-PAGE);
  53.      FreeImageMem(p);
  54.  
  55.      p:= GetImage(StartVirtualX,StartVirtualY+mitte+1,
  56.                   StartVirtualX+XMAX,StartVirtualY+mitte+1+lines,pa);
  57.      PutImage(StartVirtualX,StartVirtualY+YMAX-lines,p,1-PAGE);
  58.      FreeImageMem(p);
  59.  
  60.      INC(counter);
  61.      WHILE (ClockTicks^ < (t+counter*temp)) DO BEGIN END;
  62.     END;
  63.  
  64.    {Cleanup:}
  65.    (* IF Odd(YMAX+1)
  66.        THEN CopyPage(pa,1-PAGE); *)
  67.   END;
  68.  
  69.  
  70. VAR pal1:Palette;
  71.     i:WORD;
  72. BEGIN
  73.  InitGraph;
  74.  StartVirtualX:=20; StartVirtualY:=10;
  75.  LoadBackgroundPage(pic);
  76.  LoadPalette(picPal1,0,pal1); SetPalette(pal1,FALSE);
  77.  FillPage(1-Page,0);
  78.  FOR i:=1 TO 20000 DO
  79.   PutPixel(Random(Succ(XMAX)),Random(Succ(YMAX)),Random(256));
  80.  
  81.  VerticalSplitClose(BACKGNDPAGE,2000);
  82.  
  83.  (* So what do you expect when uncommenting the following line??? *)
  84.  (* VerticalSplitClose(1-PAGE,2000); *)
  85.  
  86.  CloseRoutines;
  87. END.
  88.